﻿#include "ArrayDialog.h"

ArrayDialog::ArrayDialog(QWidget *parent)
	: QDialog(parent)
{
	ui.setupUi(this);
}

ArrayDialog::~ArrayDialog()
{

}

void ArrayDialog::on_btn_OK_clicked()
{
	accept();
}

void ArrayDialog::on_btn_Cancel_clicked()
{
	reject();
}

void ArrayDialog::getRowColumn(int& row, int& column)
{
	row = ui.sbRow->value();
	column = ui.sbColumn->value();
}


void ArrayDialog::setFormDev(formDev* pForm)
{
	m_formDev = pForm;

	//获取选择的对象
	QList<formDev*> controlers = m_formDev->getSelected();

	std::sort(controlers.begin(), controlers.end(), [](formDev*& a, formDev*& b) {
		return a->getObjectName() < b->getObjectName();
		});

	QString s1 = QString::number(controlers[0]->geometry().x()) + "," + QString::number(controlers[0]->geometry().y());
	QString s2 = QString::number(controlers[1]->geometry().x()) + "," + QString::number(controlers[1]->geometry().y());
	QString s3 = QString::number(controlers[2]->geometry().x()) + "," + QString::number(controlers[2]->geometry().y());

	ui.le1->setText(s1);
	ui.le2->setText(s2);
	ui.le3->setText(s3);
}

void ArrayDialog::on_btnGet1_clicked()
{

}

void ArrayDialog::on_btnGet2_clicked()
{

}

void ArrayDialog::on_btnGet3_clicked()
{

}

